<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<title>报名</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="../../../../layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="../../../../css/public.css">
	<link rel="stylesheet" href="use.css" media="all" />
</head>

<body class="childrenBody">
	<form class="layui-form layui-row" style="padding: 20px;background-color: #fff;">

		<div class="layui-col-md8 layui-col-xs12">
			<div class="layui-form-item">
				<label class="layui-form-label">真实姓名</label>
				<div class="layui-input-block">
					<input type="text" value="" placeholder="请输入真实姓名" lay-verify="required"
						class="layui-input realName" id="realName">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">学号</label>
				<div class="layui-input-block">
					<input type="tel" value="" placeholder="请输入学号" lay-verify="required" class="layui-input userNumber" id="userNumber">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">性别</label>
				<div class="layui-input-block">
					<input type="tel" value="" placeholder="请输入性别" lay-verify="sex" class="layui-input " id="userSex">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">手机号码</label>
				<div class="layui-input-block">
					<input type="tel" value="" placeholder="请输入手机号码" lay-verify="phone" class="layui-input userPhone" id="userPhone">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">入学年份</label>
				<div class="layui-input-block">
					<input type="text" value="" placeholder="请输入入学年月" lay-verify="required"
						class="layui-input userBirthday" id="userBirthday">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">邮箱</label>
				<div class="layui-input-block">
					<input type="text" value="" placeholder="请输入邮箱" lay-verify="required" class="layui-input userEmail" id="userEmail">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">自我评价</label>
				<div class="layui-input-block">
					<textarea placeholder="请输入内容" class="layui-textarea myself" id="myself"></textarea>
				</div>
			</div>
			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn" lay-submit="" lay-filter="changeUser" onclick="doinsert();return false;">立即报名</button>
					<button type="reset" class="layui-btn layui-btn-danger">重置</button>
					<!-- <a href="informationInformation.html"><button class="layui-btn  layui-btn-checked">返回</button></a> -->

				</div>
			</div>
		</div>
	</form>
	<script type="text/javascript" src="../../../../layui/layui.js"></script>
	<script type="text/javascript" src="userInfo.js"></script>
	<script>
		layui.use('layer', function () {
				layer = layui.layer;
				$ = layui.jquery;
	
				// 获取焦点
				$('#login-username').focus();
	
				// 直接回车登录
				$('input').keydown(function (e) {
					if (e.keyCode == 13) {
						dologin();
					}
				});
			});
			admin = localStorage.getItem("admin"); 
			function doinsert() {
				
				var realName = $.trim($('#realName').val());
				var userNumber = $.trim($('#userNumber').val());
				var userSex = $.trim($('#userSex').val());
				var userPhone = $.trim($('#userPhone').val());
				var userBirthday = $.trim($('#userBirthday').val());
				var grade = $.trim($('#userBirthday').val());
				var userEmail = $.trim($('#userEmail').val());
				var myself = $.trim($('#myself').val());
				var classname = localStorage.getItem("SelectedAccount")
				var Teacher = localStorage.getItem("SelectedTeacherName")
				var CourseCode = localStorage.getItem("SelectedClassNumber")
				$.ajax({
					url: "http://127.0.0.1:8000/insert",
					type: "post",
					dataType: "JSON",
					data: { 
						    "realName": realName, 
							"userNumber":userNumber ,
					        "userSex":userSex,
							"userPhone": userPhone, 
							"userBirthday":userBirthday ,
							"grade":grade,
							"userEmail":userEmail,
							"myself":myself ,
							"classname" : classname,
							"Teacher":Teacher,
							"CourseCode":CourseCode
						},
					success: function (res) {
						if (res.code > 0) {
							layer.msg(res.msg);
						}
						if (res.code == 0) {
							layer.msg(res.msg);
						}
						layer.closeAll("iframe");
			//刷新父页面
			parent.location.reload();
					}
				})
	
			}
	</script>
</body>

</html>